package com.dragon.interfaces.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * <p>
 * 操作日志记录
 * </p>
 *
 * @author dragon
 * @since 2024-08-01 18:08:50
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("sys_user_operate_log")
public class UserOperateLog implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 日志主键
     */
    @TableId(value = "operate_id", type = IdType.AUTO)
    private Long operateId;

    /**
     * 追踪ID
     */
    @TableField("trace_id")
    private String traceId;

    /**
     * 操作人员
     */
    @TableField("operate_account")
    private String operateAccount;

    /**
     * 模块标题
     */
    @TableField("title")
    private String title;

    /**
     * 业务类型
     * 0:其它;
     * 1:新增;
     * 2:修改;
     * 3:删除;
     * 4:上传;
     * 5:下载;
     * 6:导出;
     * 7:导入;
     * 8:清空数据;
     * 101:更改菜单显示状态;
     * 102:更改菜单状态;
     * 201:更改角色状态;
     * 202:批量添加授权用户;
     * 203:批量删除授权用户;
     * 301:更改用户状态;
     * 302:批量添加授权角色
     */
    @TableField("business_type")
    private Integer businessType;

    /**
     * 方法名称
     */
    @TableField("method")
    private String method;

    /**
     * 请求方式
     */
    @TableField("request_method")
    private String requestMethod;

    /**
     * 请求URL
     */
    @TableField("request_url")
    private String requestUrl;

    /**
     * 主机地址
     */
    @TableField("request_ip")
    private String requestIp;

    /**
     * 操作地点
     */
    @TableField("operate_location")
    private String operateLocation;

    /**
     * 请求参数
     */
    @TableField("request_param")
    private String requestParam;

    /**
     * 返回参数
     */
    @TableField("json_result")
    private String jsonResult;

    /**
     * 操作状态(1:正常;0:异常)
     */
    @TableField("status")
    private Byte status;

    /**
     * 错误消息
     */
    @TableField("error_msg")
    private String errorMsg;

    /**
     * 操作时间
     */
    @TableField("operate_time")
    private LocalDateTime operateTime;

    /**
     * 消耗时间
     */
    @TableField("cost_time")
    private Long costTime;

    public static final String OPERATE_ID = "operate_id";

    public static final String TRACE_ID = "trace_id";

    public static final String OPERATE_ACCOUNT = "operate_account";

    public static final String TITLE = "title";

    public static final String BUSINESS_TYPE = "business_type";

    public static final String METHOD = "method";

    public static final String REQUEST_METHOD = "request_method";

    public static final String REQUEST_URL = "request_url";

    public static final String REQUEST_IP = "request_ip";

    public static final String OPERATE_LOCATION = "operate_location";

    public static final String REQUEST_PARAM = "request_param";

    public static final String JSON_RESULT = "json_result";

    public static final String STATUS = "status";

    public static final String ERROR_MSG = "error_msg";

    public static final String OPERATE_TIME = "operate_time";

    public static final String COST_TIME = "cost_time";

}
